function AiQiYi() {

}

AiQiYi.prototype = {
    constructor : AiQiYi,

    slideShow : function () {
        var li = document.querySelectorAll(".slideShow ul li");
        var bg = document.querySelector(".slideShow");

        var index = 1 ;
        li[index-1].style.background = "#63B504";
        li[index-1].style.color = "white";
        var timer;
        function autoplay() {
            timer = setInterval(function () {
                index++;
                if(index == 11){
                    index = 1
                }
                bg.style.background = "url('image/"+index+".jpg')";
                bg.style.backgroundPosition = "center center";
                for(var i = 0 ; i < li.length ; i++){
                    li[i].style.background = "#181818";
                    li[i].style.color = "#cccccc";
                }
                li[index-1].style.background = "#63B504";
                li[index-1].style.color = "white";
            },5000);
        }
        autoplay();
     bg.onmouseover = function () {
         clearInterval(timer);
     };
     bg.onmouseout = function () {
         autoplay();
     };

     for(var j = 0 ; j < li.length ; j++){
         li[j].num = j;
         li[j].onmouseover = function () {
             for(var s = 0 ; s < li.length ; s++){
                 li[s].style.background = "#181818";
                 li[s].style.color = "#cccccc";
             }
             this.style.background = "#63B504";
             bg.style.background = "url('image/"+(this.num+1)+".jpg')";
             bg.style.backgroundPosition = "center center";
             this.style.color = "white";
             index = this.num+1;
         }
     }
    },

    lunBo1 : function () {
        var imgList = ["image/2ce8f06872c044fbab9c1a0b457d2afb.jpg","image/67bf2954a6454cc689d3c3fa2f4c6b5b.jpg"];
        var textList = ["超凡魔术师","漂亮的房子"];
        var wrap = document.getElementsByClassName("todayCenter_1")[0];
        var btnArr = document.querySelectorAll(".btn1 div");
        var box = document.querySelector(".todayCenter_1bottom span");
        var index  = 0;
        btnArr[0].onclick = function () {
            index -- ;
            if(index == -1){
                index = 1;
            }
            wrap.style.background = "url('"+imgList[index]+"')";
            box.innerHTML = textList[index]
        };
        btnArr[1].onclick = function () {
            index ++;
            if(index == 2){
                index = 0;
            }
            wrap.style.background = "url('"+imgList[index]+"')";
            box.innerHTML = textList[index]
        }
    },

    navPosition : function () {
        function size() {
            if(document.documentElement.clientWidth <=1110 ){
                $(".topNew").fadeOut()
            }else{
                $(".topNew").fadeIn()
            }
        }

        $(window).on("scroll",function () {
            if($(window).scrollTop() >= 600){
                    $(".topNew").css({
                        position : "fixed",
                        width : "100%",
                        top : 0,
                        left : 0,
                        "z-index" : 10,
                        "padding-left" : "34px",
                        opacity : "0.9"
                    });
                    $(".topNew").children("ul").css({
                        "margin-right" : 98
                    });

                $(window).on("resize",size);
            }else{
                $(".topNew").css({
                    position : "relative",
                    top : 0,
                    left : 0,
                    "z-index" : 10,
                    "padding-left" : 0,
                    opacity : 1
                }).show();
                    $(window).off("resize",size);
                $(".topNew").children("ul").css({
                    margin :0,
                    "padding-right" : 20,
                    float : "right"
                })
            }
        })
    },
    
    historyHover : function () {
        $(".continue_2 ul li").each(function (i) {
            $(".continue_2 ul li").eq(i).hover(function () {
                $(this).children().first().children().first().css({
                    color : "#5AA700"
                });
                $(this).children().first().children().last().children().css({
                    background : "url('image/site-icons-qyIndex_v2.png')",
                    backgroundPosition : "-60px -240px",
                });
                $(this).children().last().children().last().children().last().children().last().show()
            },function () {
                $(this).children().first().children().first().css({
                    color : "black"
                });
                $(this).children().first().children().last().children().css({
                    background : "url('image/site-icons-qyIndex_v2.png')",
                    backgroundPosition : "-40px -240px",
                });
                $(this).children().last().children().last().children().last().children().last().hide()
            })
        });
       $(".play").each(function (i) {
           $(".play").eq(i).hover(function () {
               $(this).css("background","url('image/播放1.png')").css("backgroundSize","100% 100%")
           },function () {
               $(this).css("background","url('image/播放.png')").css("backgroundSize","100% 100%")
           })
       });
       $(".history_1").each(function (i) {
           $(".history_1").eq(i).hover(function () {
               $(this).children().first().children().show();
           },function () {
               $(this).children().first().children().hide();
           })
       })

    },

    lunBo2 : function () {
        var imgList = ["image/3a2812e54be8424997250a237c16859f.jpg","image/a5daf94ea9784d6796b07ce77e429c6d.jpg"];
        var text1 = ["男子甜点俱乐部","天使之路26，29双播"];
        var text2 = ["河神CP上演分手戏码","丝绸之路走选手摔倒不断"];
        var index = 0;
        var timer;
        function autoplay() {
             timer =  setInterval(function () {
                index ++;
                if(index == 2){
                    index = 0
                }
                $(".variety_1-play").css("background","url("+imgList[index]+")");
                $(".variety_1-text p").eq(0).children().text(text1[index]);
                 $(".variety_1-text p").eq(1).children().text(text2[index]);
            },2000);
        }
        autoplay();
        $(".variety_1").on("mouseover",function(){
            clearInterval(timer)
        });
        $(".variety_1").on("mouseout",function () {
            autoplay();
        });
        $(".variety_1-play-Btn").each(function (i) {
            $(".variety_1-play-Btn").eq(i).on("click",function () {
                if(i == 0){
                    index --;
                    if(index == -1){
                        index = 1
                    }
                    $(this).parent().css("background","url("+imgList[index]+")");
                    $(".variety_1-text p").eq(0).children().text(text1[index]);
                    $(".variety_1-text p").eq(1).children().text(text2[index]);
                }else{
                    index ++;
                    if(index == 2){
                        index = 0
                    }
                    $(this).parent().css("background","url("+imgList[index]+")");
                    $(".variety_1-text p").eq(0).children().text(text1[index]);
                    $(".variety_1-text p").eq(1).children().text(text2[index]);
                }
            });
            $(".variety_1-play-Btn").eq(i).hover(function () {
                if(i == 0){
                    $(this).css({
                        backgroundPosition : "-40px -320px"
                    })
                }else{
                    $(this).css({
                        backgroundPosition : "-120px -320px"
                    })
                }
            },function () {
                if(i == 0){
                    $(this).css({
                        backgroundPosition : "0 -320px"
                    })
                }else{
                    $(this).css({
                        backgroundPosition : "-80px -320px"
                    })
                }
            })
        })
    }
};

